<script language="JavaScript">
<!--
function Menu(cible,Objet)
{
	eval(cible+".location='"+Objet.options[Objet.selectedIndex].value+"'");
}
//-->
</script>

<?php
$req_cat = $bdd->query('SELECT * FROM categories_articles ORDER BY nom');
?>
</script>
<table><tr>
<td>
<select id="categorie" name="categorie" onChange="Menu('parent',this)">
	<optgroup label="Catégories">
	<?php
	while ($donnees_cat = $req_cat->fetch())
	{
		?>
		<option value="index.php?page=articles&cat=<?php echo $donnees_cat['id']; ?>"><?php echo $donnees_cat['nom']; ?></option>
		<?php
	}
	?>
	</optgroup>
</select>
</td><td>
<?php
$req_cat = $bdd->query('SELECT * FROM articles ORDER BY titre');
?>
<select id="article" name="article" onChange="Menu('parent',this)">
	<optgroup label="Articles">
	<?php
	while ($donnees_cat = $req_cat->fetch())
	{
		?>
		<option value="index.php?page=articles&id=<?php echo $donnees_cat['id']; ?>"><?php echo substr($donnees_cat['titre'], 0, 40); ?>..</option>
		<?php
	}
	?>
	</optgroup>
</select>
</td><td>
<?php
if ((isset($_SESSION['identifiant'])) AND (!empty($_GET['id'])))
{
	?>
	<form method="post" action="index.php?page=admin_articles">
		<input type="hidden" name="id" value="<?php echo $_GET['id']; ?>">
		<input type="submit" value="Editer" name="editer" class="bouton" />
		<input type="submit" value="Nouvel article" name="nouveau" class="bouton" />
	</form>
	<?php
}
?>
</td></tr></table>
<hr/>